
   [LINK] 
   
                          Paul's 8051 Code Library
                               Free 8051 Code
                                      
     _________________________________________________________________
                                      
   These routines generate a sequence of pseudo-random numbers using the
   ordinary linear feedback shift register technique. Both routines
   require memory to hold the last number generated. They produce a
   predictable but randomly distributed sequence of numbers, similar to
   the rand() function in most C libraries.
   
   No routine analogous to srand() is provided, but it is easily
   implemented by writing the seed value into the memory which holds the
   previously generated number. These routines check for zero (the
   illegal value), so it is not necessary to initialize the memory with a
   seed value unless a predictable starting seed is required or a truely
   random number is available.
   
   RAND8
          Generate an 8 bit pseudo random number, from 1 to 255. The
          number is returned in Acc.
          
   RAND16
          Generate a 16 bit pseudo random number, from 1 to 65535. The
          number is returned in Acc (lsb) and B (msb).
          
   This code is available as plain text or in a zip file.
   
     _________________________________________________________________
                                      
   Paul's 8051 Code Library, Paul Stoffregen
   http://www.ece.orst.edu/~paul/8051-goodies/rand.html
   Last updated: Thursday, 04 July 1996
   Status: complete
   Suggestions, comments, criticisms: <paul@ece.orst.edu>
     _________________________________________________________________
                                      
   [LINK] Return to Paul's 8051 Goodies Index 
